//
//  Brandlist.m
//  __PRODUCTNAME__
//
//  Created by QC.L on 16/08/10
//  Copyright (c) . All rights reserved.
//

#import "Brandlist.h"
#import "Brand.h"

@implementation Brandlist

+ (NSDictionary *)objectClassInArray{
    return @{@"list" : [Brand class]};
}

- (void)setValue:(id)value forKey:(NSString *)key { // value的类型是变得, 根据key值不同, value的类型也不一样(json)
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"list"]) { // 如果key是list, 开始解析
        NSMutableArray<Brand *> *brandArray = [NSMutableArray array];
        for (NSDictionary *brandDic in value) {
            Brand *brand = [Brand modelWithDic:brandDic];
            [brandArray addObject:brand];
        }
        _list = brandArray;
    }
}

@end
